package com.bawei.park2211a.adapter

import android.graphics.Color
import com.bawei.base.bean.EquipmentEntity
import com.bawei.park2211a.R
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder

class EquipmentAdapter:BaseQuickAdapter<EquipmentEntity,BaseViewHolder>(R.layout.item_equipment) {
    override fun convert(helper: BaseViewHolder, item: EquipmentEntity) {
        helper.setText(R.id.equipment_area,item.installationLocation)
        helper.setText(R.id.equipment_name,item.deviceName)
        helper.setText(R.id.equipment_type,item.deviceType)
        helper.setText(R.id.equipment_rate,item.failureRate.toString()+"%")
        helper.setText(R.id.equipment_staut,item.status)
        when(item.status){
            "正常"->{
                helper.setTextColor(R.id.equipment_staut,Color.GREEN)
            }
            else->{
                helper.setTextColor(R.id.equipment_staut,Color.YELLOW)
            }
        }
    }
}